<?php 
$this->headScript()->appendScript( '
	var tab = new Array();
	function pick_price()
	{
		$("#amount").val(tab[$("#products_p_id").val()][$("#currency_cur_id").val()]);
	}
	');
foreach($this->products as $one)
{
	$price = unserialize($one['price']);
	$this->headScript()->appendScript( 'tab['.$one['p_id'].'] = new Array();');
	foreach($this->cur_list as $key => $val)
	{
		$this->headScript()->appendScript( 'tab['.$one['p_id'].'] ['.$key.']= "'.$price[$val].'";');
	}
}
?>
<table>
	<tr>
		<td>
			<a class="button" href="<?php echo $this->baseUrl() ?>/cptransactions">
				<div style="background:url(<?php echo $this->baseUrl() ?>/public/images/left_16.png);" class="inb">Wróć do listy</div>
			</a>
		</td>
		<td>
			<a class="button" href="javascript:void(null)" onclick="$('#formitem').submit()">
				<div style="background:url(<?php echo $this->baseUrl() ?>/public/images/save_16.png);" class="inb">Zapisz</div>
			</a>
		</td>
	</tr>
</table>

<h2>Dodaj nową transakcje</h2>
<form method="post" id="formitem" >
	<table cellpadding="5" border="0" cellspacing="5"  class="tform">
		<tr>
			<td>Wybierz produkt</td>
			<td>
				<?php echo $this->formSelect('products_p_id', @$this->item['products_p_id'], array("onchange" => "pick_price();"), $this->prod_list) ?>
			</td>
		</tr>
		<tr>
			<td>Waluta</td>
			<td>
				<?php echo $this->formSelect('currency_cur_id', @$this->item['currency_cur_id'], array("onchange" => "pick_price();"), $this->cur_list) ?>
			</td>
		</tr>
		<tr>
			<td>Cena</td>
			<td>
				<?php echo $this->formText('amount', @$this->item['amount']);?>
			</td>
		</tr>
		<tr>
			<td>Opłacone?</td>
			<td>
				<?php echo $this->formSelect('paid', @$this->item['paid'],'', array('yes' => 'Tak', 'no' => 'Nie')) ?>
			</td>
		</tr>
		<tr>
			<td>Email użytkownika</td>
			<td>
				<?php echo $this->formText('email', @$this->item['email']).'<br />'; ?>
			</td>
		</tr>
		<tr>
			<td>Telefon użytkownika</td>
			<td>
				<?php echo $this->formText('phone', @$this->item['phone']).'<br />'; ?>
			</td>
		</tr>
		<tr>
			<td>GG użytkownika</td>
			<td>
				<?php echo $this->formText('gg', @$this->item['gg']).'<br />'; ?>
			</td>
		</tr>
	</table>
</form>